<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<jsp:directive.page import="java.sql.*"/>
<jsp:directive.page import="Connectivity.ConnectionManager"/>
 <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String Activity = request.getParameter("Activity")!=null?request.getParameter("Activity"):"2";
String status = request.getParameter("status")!=null?request.getParameter("status"):"null";
%>
   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
   "http://www.w3.org/TR/html4/loose.dtd">

   <html>

      <head>
 		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>   Customer Registration  </title>
        <link rel="stylesheet" href="css/displaytag.css" type="text/css">
        <link rel="stylesheet" href="css/screen.css" type="text/css">
        <link rel="stylesheet" href="css/site.css" type="text/css">
      </head>
 <SCRIPT language=JavaScript>
	var reset = 0;
	var lastKeyCode = 0;
	var lastKeyCode1 = 0;
    var lastKeyCode2 = 0;
     
var flag1=0;
function mySubmit()
{
  var flag=0;			
 
		 
 			 
			 
			 if(flag==0)
			{ document.custregistration.action = "/Genius/CustomerServlet?flag=1";
			document.custregistration.submit();
		    return true;
		     }
		     
		     else 
		     {
		     alert(" in else");
		     return false;}
			  
		}		

	 

	 
function isEmailId(string) 
	{
		 
	if(string.search(/^[A-Za-z](([A-Za-z0-9])|(\.[A-Za-z0-9])|(\_[A-Za-z0-9]))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!= -1)
		return true;
	else
		return false;
	}

	
	function setFocusOnLoad(){
		window.document.custregistration.elements[0].focus();
	}
	
	function startsWithDigit(val)	{
		var counter		= 0;
		var	singleChar	= "";
		var	validChars	= "0123456789";
	
		if(isBlank(val))
			return false;
	
		val = val.substr(0, 1);
	
		if(validChars.indexOf(val) != -1){
			return false;
		}
		return true;
	}
	

	
	/*function  stopSpecialChar(){
		if((window.event.keyCode >= 33  && window.event.keyCode <= 44) || (window.event.keyCode >= 47  && window.event.keyCode <= 48) || (window.event.keyCode >= 57  && window.event.keyCode <= 64) || window.event.keyCode == 96 || (window.event.keyCode >= 91  && window.event.keyCode <= 94) || (window.event.keyCode >= 123  && window.event.keyCode <= 126)){
		window.event.keyCode = 0;
		}
	}*/
	
  </SCRIPT>
      
<body bgcolor="white">
<table border=1 width=100% height=100%>
<tr><td>
<table align=right height=20% width=100% >
			<tr>
			  <td align=right><%=(session.getAttribute("firm_name"))%></td>
			 <td align=right><img src="<%=basePath%>images\Company.jpg" height=119 width=109></td> 
			 </tr>
			</table>

 </tr></td>
 <tr><td><marquee>welcome <%=(session.getAttribute("uname")) %></marquee>

 </td></tr>
 
 <tr><td>
 <table width=100% height=80%>
 <tr >
 <table id=Employee align=left border=1  width=20% cellspacing="20" cellpadding="8">
 <%
 int role_id=Integer.parseInt(""+(session.getAttribute("role_id")));
 String mainimage=null,maindesc=null;
 Connection con=null;
 PreparedStatement prst=null,prst1=null;
		String firm_id=null,firm_name=null,firm_city=null,firm_image=null;
	try
	{	
		con=ConnectionManager.getConnection();
  
	String querry="select mlm.main_link_id,mlm.main_link_desc,mlm.main_link_information,trim(mlm.main_link_image_location)as image_path ";
	 querry=querry+"from access_control_list acl JOIN main_link_master mlm ON (acl.main_link_id=mlm.main_link_id and  mlm.status='V' and acl.role_id="+role_id+") ";
     querry=querry+"group by mlm.main_link_desc,mlm.main_link_information,trim(mlm.main_link_image_location),mlm.main_link_id,mlm.order_id ";
     querry=querry+"order by mlm.order_id ";
	 prst=con.prepareStatement(""+querry);
	    ResultSet rs=prst.executeQuery();
	    if(rs.equals(null))
	  {
 
out.println(" Error");
 		
 	   }
 	   else
 	   { int cnt=1;
 	   while(rs.next())
 	   {
if(Activity.equals(rs.getString(1)))
{
mainimage=rs.getString(4);
maindesc=rs.getString(3);

}
  %>
  
<tr><td align="center">
<a href='/Genius/form/general/userLogged.jsp?Activity=<%=rs.getString(1)%>'><%=rs.getString(2)%></a></td></tr>
<%}

} %>

</tr>
<tr><td align="center">
<a href='/Genius/form/general/Login.jsp'>Logout</a></td></tr>

 
<form name=custregistration method=get action="/Genius/CustomerServlet?flag=1" >
    <table align=center border=1  >
    <%
    if(status.equalsIgnoreCase("I"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> INSERTED SUCCESSFULLY </font> </td></tr>");
    }
     if(status.equalsIgnoreCase("U"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> UPDATED SUCCESSFULLY </font> </td></tr>");
    }
     if(status.equalsIgnoreCase("D"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> DELETED SUCCESSFULLY </font> </td></tr>");
    }
     %>
    <tr><td align=center   colspan=10><font size=6 color=Blue> CUSTOMER REGISTRATION </font> </td></tr>
<tr><td align=left colspan=5 >NAME:&nbsp;<font color="red">*</font>&nbsp;&nbsp;</td><td align=left colspan=5><input type=name name= name value="" required> </td></tr>
<tr><td align=left colspan=5 >BRANCH/AREA:&nbsp;<font color="red">*</font>&nbsp;&nbsp;</td><td align=left  colspan=5><input type=text name=branch value="" required> </td></tr>
<tr><td align=left  colspan=5>PHONE NO:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><input type=text name=telephone1 size=12 value=""> </td></tr>
<tr><td align=left  colspan=5>ALTERNATE PHONE NO.:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><input type=text name=telephone2 size=12 value=""> </td></tr>
<tr><td align=left colspan=5 >MOBILE NO:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><input type=text maxlength=10 name=mobileno size=10 value=""> </td></tr>
<tr><td align=left colspan=5 >EMAILID:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><INPUT maxLength=100 size=30 name=email> </td></tr>
<tr><td align=left  colspan=5>ADDRESS:&nbsp;<font color="red">*</font>&nbsp;&nbsp;</td><td align=left colspan=5><TEXTAREA required="true" rows=3 cols=25 name=address ></TEXTAREA>  </td></tr>
<!--   <TR> <TD align=right><INPUT   onclick=displayRow(this) value=customer1 type=radio name=customer1>CUSTOMER 1</TD>
     <TD align=left><INPUT onclick=displayRow(this)  value=customer2  type=radio name=customer2>CUSTOMER 2</TD>
 </TR>-->

<TR  ><td align=left  colspan=5>CONTACT PERSON 1/ MANAGER:&nbsp;<font color="red">*</font>&nbsp;&nbsp;</td><td align=left colspan=5><input   type=text name= cust1 value="" required> </td></tr>
<TR  ><td align=left  colspan=5>MOBILE NO OF CONTACT PERSON1:&nbsp;<font color="red">*</font>&nbsp;&nbsp;</td><td align=left colspan=5><input size=10 maxlength=10  type=text name= cust1mobile value="" required> </td></tr> 

<TR  ><td align=left  colspan=5>CONTACT PERSON 2/ ACCOUNTANT:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><input   type=text name= cust2 value=""> </td></tr>
<TR  ><td align=left colspan=5 >MOBILE NO OF CONTACT PERSON2:&nbsp;&nbsp;&nbsp;</td><td align=left colspan=5><input size=10 maxlength=10  type=text name= cust2mobile value=""> </td></tr> 
 
 
 <tr><td align=right  colspan=5 ><input type=submit name=submit value="Create" onclick="mySubmit()" >
 &nbsp;&nbsp;&nbsp;&nbsp;</td><td align=left  colspan=5><input type=reset name=reset value="Reset"> </td></tr>
 
 


    </table>     
   </form>    
       
       
       
       
          
      

 
</tr>
</tr></td>   
<%
}
catch(Exception e)
{e.printStackTrace();}

 %></td></tr></table>

      </body>
	
   </html>